package com.skytech.chatim.sky.xmlapi;

import com.skytech.chatim.sky.xmlapi.command.GetUser;
import com.skytech.chatim.sky.xmlapi.command.XmlApiCommandResult;



/**
 * Created by jasonc on 2015/5/21.
 */
public class XmlApiManager {
    private static XmlApiManager instance = new XmlApiManager() ;

    private XmlApiManager() {
    }

    public String getUserMeetingKey(WebexConfig webexConfig) {
        XmlApiClient XmlApiClient = new XmlApiClient(webexConfig);
        GetUser command = new GetUser(webexConfig.getUserName());
        XmlApiCommandResult XmlApiCommandResult = XmlApiClient.issueCommand(command);
        String key = XmlApiCommandResult.getBodyNode().selectSingleNode("//use:personalMeetingRoom/use:accessCode").getText();
        return key;
    }

    public static XmlApiManager getInstance() {
        return instance;
    }


}
